package com.zwb.demo.easyweb.modules.config.controller;

import com.zwb.demo.easyweb.common.entity.response.ResponseResult;
import com.zwb.demo.easyweb.modules.config.service.JavaFieldService;
import com.zwb.demo.easyweb.modules.config.vo.JavaFieldTypeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(value = "java字段管理接口" ,description = "java字段管理接口")
public class JavaFieldController {

    private final JavaFieldService javaFieldService;


    @Autowired
    public JavaFieldController(JavaFieldService javaFieldService) {
        this.javaFieldService = javaFieldService;
    }

    @GetMapping("/config/javaField")
    @ApiOperation(value = "查询所有java字段类型")
    public ResponseResult findAll(){
        return javaFieldService.findAll();
    }

    @PutMapping("/config/javaField")
    @ApiOperation(value = "新增或修改java字段类型")
    public ResponseResult addOne(@RequestBody JavaFieldTypeVO vo){
        return javaFieldService.addOrUpdateOne(vo);
    }

    @DeleteMapping("/config/javaField/{uuid}")
    @ApiOperation(value = "删除java字段类型")
    public ResponseResult deleteOne(@PathVariable String uuid){
        return javaFieldService.deleteOne(uuid);
    }

}
